package book_management;

import book_management.book.BookList;
import book_management.user.AdminUser;
import book_management.user.NormalUser;
import book_management.user.User;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        User user=login();
        BookList bookList=new BookList();
        while(true){
            int choice=user.menu();
            if(choice==-1){
                System.out.println("ByeBye~");
                break;
            }
            user.doOperation(choice,bookList);
        }
    }

    public static User login(){
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入用户名:");
        String userName=scanner.next();
        System.out.println("请输入您的身份，1表示普通用户，0表示管理员");
        int choice=scanner.nextInt();
        if(choice==-1){
            return new NormalUser(userName);
        }
        return new AdminUser(userName);
    }
}
